package _0219_._04_example.model;

/**
 * 用来模拟数据库，存储商品数据
 */
public class ProductData {

    public static Product[] allProducts;


    // 静态代码块，给商品数组进行赋值
    static {

        // 1. 初始化
        allProducts = new Product[10];

        // 2. 存放商品数据
        Product p1 = new Product(1001,"茅台飞天酒",2499,"中国人的拉菲");
        Product p2 = new Product(1002,"阿迪王运动鞋",99,"穿上它，飞一般的感觉");
        Product p3 = new Product(1003,"华为Mate70 Pro 保时捷版",12999,"华为手机，东半球最好用的手机");
        Product p4 = new Product(1004,"小米SU7",229999,"小米汽车，年轻人的第一台汽车");
        Product p5 = new Product(1005,"联想拯救者电脑",7999,"买拯救者电脑，学习才能学得好");
        Product p6 = new Product(1006,"TCL电视",6999,"中国人自己的索尼电视");

        allProducts[0] = p1;
        allProducts[1] = p2;
        allProducts[2] = p3;
        allProducts[3] = p4;
        allProducts[4] = p5;
        allProducts[5] = p6;

    }
}
